﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="ShareMarking.Web.admin.login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员登录</title>
<link href="skin/default/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../scripts/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    $(function () {
        //检测IE
        if ('undefined' == typeof (document.body.style.maxHeight)) {
            window.location.href = 'ie6update.html';
        }

        ChangeCodeImg();

        $('#imageCheck').bind('click', function () {
            ChangeCodeImg();
        });

        function jtip(tip) {
            if(tip) $('#msgtip').html(tip);
        }

        $('#<%=btnSubmit.ClientID %>').bind('click', function () {
            var username = $('#<%=txtUserName.ClientID %>').val();
            if (!username) {
                jtip('请输入用户名');
                return false;
            }
            var password = $('#<%=txtPassword.ClientID %>').val();
            if (!password) {
                jtip('请输入密码');
                return false;
            }
            var checkcode = $('#<%=txtCheckCode.ClientID %>').val();
            if (!checkcode) {
                jtip('请输入验证码');
                return false;
            }
            return true;
        });
    });
    
    //随机数方法
    rnd.today = new Date();
    rnd.seed = rnd.today.getTime();
    function rnd() {
        rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
        return rnd.seed / (233280.0);
    };

    function rand(number) {
        return Math.ceil(rnd() * number);
    }; 

    function imageLoaded() {
        document.getElementById("<%=btnSubmit.ClientID %>").disabled = "";
    }

    function ChangeCodeImg() {
        var a = document.getElementById("imageCheck");
        a.src = "/admin/common/checkcode.aspx?" + rand(10000000);
        document.getElementById("<%=btnSubmit.ClientID %>").disabled = true;
        document.getElementById("<%=txtCheckCode.ClientID %>").value = "";
    }
</script>
<style type="text/css">
    #imageCheck{cursor: pointer;margin-top: 1px; margin-left:3px;float: left;height: 42px;width: 93px;}
    .check-code{ width: 200px;float: left;}
</style>
</head>

<body class="loginbody">
<form id="form1" runat="server">
<div class="login-screen">
	<div class="login-icon">LOGO</div>
    <div class="login-form">
        <h1>系统管理登录</h1>
        <div class="control-group">
            <asp:TextBox ID="txtUserName" runat="server" CssClass="login-field" placeholder="用户名" title="用户名"></asp:TextBox>
            <label class="login-field-icon user" for="txtUserName"></label>
        </div>
        <div class="control-group">
            <asp:TextBox ID="txtPassword" runat="server" CssClass="login-field" TextMode="Password" placeholder="密码" title="密码"></asp:TextBox>
            <label class="login-field-icon pwd" for="txtPassword"></label>
        </div>
        <div class="control-group">
            <asp:TextBox ID="txtCheckCode" runat="server" CssClass="login-field check-code" placeholder="验证码" title="验证码"></asp:TextBox>
            <img onload="javascript:imageLoaded();" id="imageCheck" title="点击更换验证码图片!" />
        </div>
        <div><asp:Button ID="btnSubmit" runat="server" Text="登 录" CssClass="btn-login" OnClick="btnSubmit_Click"/></div>
        <span class="login-tips"><i></i><b id="msgtip" runat="server">请输入用户名和密码</b></span>
    </div>
    <i class="arrow">箭头</i>
</div>
</form>
</body>
</html>